import { shallowRef } from 'vue';
export function useAbortController() {
  const controller = shallowRef(new AbortController());

  const setController = () => {
    controller.value = new AbortController();
  }

  const abort = () => {
    if (typeof controller.value.abort === 'function') controller.value.abort();
    setController();
  }
  return {
    controller,
    abort,
  }
}